import { resolve } from "path";
import { readdirSync } from "fs";

export function normalPath(path:string):string{
	return path.startsWith('/')?path :`/${path}`;
}


export function loadAllScriptFileOnDir(dirName:string):void{
	const dirPath = resolve(__dirname,`../${dirName}`);
	const files = readdirSync(dirPath);
	files.forEach((fileName:string)=>{
		let filePath = resolve(dirPath,`./${fileName}`);
		if(/\.(js|ts)/.test(filePath)){
			require(filePath);
		}
	})
}